//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.oriental.manage.controller.speciallyUpdate;

import org.dozer.DozerBeanMapper;
import org.dozer.loader.api.BeanMappingBuilder;
import org.dozer.loader.api.TypeMappingOptions;

import java.util.*;

public class BeanMapperTestUtil {
    private static DozerBeanMapper dozer = new DozerBeanMapper();

    static {
        BeanMappingBuilder configure = new BeanMappingBuilder() {
            @Override
            protected void configure() {
                mapping(String.class, Date.class, TypeMappingOptions.dateFormat("yyyy-MM-dd"));
            }
        };

        dozer.addMapping(configure);
    }

    public BeanMapperTestUtil() {
    }

    public static <T> T objConvert(Object obj, Class<T> toObj) {
        return null == obj?null:dozer.map(obj, toObj);
    }

    public static <T> List<T> mapList(Collection sourceList, Class<T> toObj) {
        if(null == sourceList) {
            return null;
        } else {
            ArrayList destinationList = new ArrayList();
            Iterator i$ = sourceList.iterator();

            while(i$.hasNext()) {
                Object sourceObject = i$.next();
                Object destinationObject = dozer.map(sourceObject, toObj);
                destinationList.add(destinationObject);
            }

            return destinationList;
        }
    }

    public static void copy(Object source, Object toObj) {
        if(null != source) {
            dozer.map(source, toObj);
        }

    }
}
